//
//  SetingViewController.m
//  ForengnMenu
//
//  Created by @-@ on 16/1/14.
//  Copyright © 2016年 余旺. All rights reserved.
//

#import "SetingViewController.h"
#import "SetingTableViewCell.h"

@interface SetingViewController ()

@property NSArray * accounts;

@property NSArray * contents;

@property NSArray * imageViews;

@property NSArray * imageViews2;

@property NSArray * nameLabels;

@property NSArray * nameLabels2;


@property NSArray * bangding;

@end

@implementation SetingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    

    self.accounts = @[@"帐号：",@"密码："];
    
    self.contents = @[@"158****1314",@"*******"];
    
    self.imageViews=@[@"iconfont-xiaoxitongzhi.png",@"iconfont-qingchuhuancun.png",@"iconfont-jianchagengxin.png"];
    
    self.imageViews2=@[@"iconfont-iconfontwo.png"];
    
    self.nameLabels=@[@"消息通知",@"清理缓存",@"检查更新"];
    
    self.nameLabels2=@[@"关于我们"];
    
    self.bangding=@[@"已绑定",@""];
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 2;
    }else if (section == 1){
        return 3;
    }else if(section == 2){
        return 1;
    }else{
        return 1;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString * identfier;
    
    if (indexPath.section == 0) {
        identfier = @"cell1";
    }else if(indexPath.section == 1 || indexPath.section == 2){
        identfier = @"cell2";
    }else{
        identfier = @"cell3";
    }
    
    SetingTableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:identfier];
    
        
    if(indexPath.section==0){
       cell.accountLabel.text = self.accounts[indexPath.row];
       cell.contentLabel.text = self.contents[indexPath.row];
       cell.bangDingLabel.text= self.bangding[indexPath.row];
    }
    else if(indexPath.section==1){
        
    cell.imageView2.image=[UIImage imageNamed:self.imageViews[indexPath.row]];
    
    cell.nameLabel.text=self.nameLabels[indexPath.row];
    
    }else if(indexPath.section == 2){
        cell.imageView2.image=[UIImage imageNamed:self.imageViews2[indexPath.row]];
        
        cell.nameLabel.text=self.nameLabels2[indexPath.row];
    }else{
    
    }
    
    return cell;
    
    
}

//点击时触发
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //取消选择状态
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
}


- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    
    return @"";
}

- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
    
    return @"";
}

- (IBAction)SetingBnt:(id)sender {
    
    
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
    
}



@end
